String.prototype.trim= function(){  
    // 用正则表达式将前后空格  用空字符串替代。  
    return this.replace(/(^\s*)|(\s*$)/g, "");  
};

var curwwwpath=window.document.location.href;
var pathname = window.document.location.pathname;    
var pos = curwwwpath.indexOf(pathname);    //获取主机地址
var localhostpath = curwwwpath.substring(0,pos);    //获取带"/"的项目名，
var projectname=pathname.substring(0,pathname.substr(1).indexOf('/')+1);
var baseUrl = localhostpath + projectname;

function _commonCloseMainFrame(){
	window.parent._closeMainFrame();
}
 
var userAgent = navigator.userAgent,   
rMsie = /(msie\s|trident.*rv:)([\w.]+)/,   
rFirefox = /(firefox)\/([\w.]+)/,   
rOpera = /(opera).+version\/([\w.]+)/,   
rChrome = /(chrome)\/([\w.]+)/,   
rSafari = /version\/([\w.]+).*(safari)/;  
var browser;  
var version;  
var ua = userAgent.toLowerCase();  
function uaMatch(ua) {  
    var match = rMsie.exec(ua);  
    if (match != null) {  
        return { browser : "IE", version : match[2] || "0" };  
    }  
    var match = rFirefox.exec(ua);  
    if (match != null) {  
        return { browser : match[1] || "", version : match[2] || "0" };  
    }  
    var match = rOpera.exec(ua);  
    if (match != null) {  
        return { browser : match[1] || "", version : match[2] || "0" };  
    }  
    var match = rChrome.exec(ua);  
    if (match != null) {  
        return { browser : match[1] || "", version : match[2] || "0" };  
    }  
    var match = rSafari.exec(ua);  
    if (match != null) {  
        return { browser : match[2] || "", version : match[1] || "0" };  
    }  
    if (match != null) {  
        return { browser : "", version : "0" };  
    }  
}  
var browserMatch = uaMatch(userAgent.toLowerCase());  
if (browserMatch.browser) {  
    browser = browserMatch.browser;  
    version = browserMatch.version;  
}
//document.write(browser+version);
function getExplorerType(){
	return browser;
}
function getExplorerVersion(){
	return version;
}

function getDialogHeight(){
	if(getExplorerType()=="IE")
		return document.documentElement.clientHeight;
	else
		return document.body.clientHeight;
}

function getDialogWidth(){
	 if(getExplorerType()=="IE")
		return document.documentElement.clientWidth;
	else
		return document.body.clientWidth;
}